package com.example.internetplus.controller;

import com.example.internetplus.accelerationService.UserService;
import com.example.internetplus.domain.dto.LoginFormatDto;
import com.example.internetplus.domain.po.User;
import com.example.internetplus.domain.query.Userquery;
import com.example.internetplus.domain.vo.UserVO;
import com.example.internetplus.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;

@Api("登录接口")
@RestController
@RequestMapping("/users")
public class UserController {
    @Autowired
    private UserService userService;
    @PostMapping("/login")
    @ApiOperation("登录接口")
    public Result login(@RequestBody @ApiParam("账号密码") LoginFormatDto loginFormatDto){
       return userService.loginCheck(loginFormatDto);
    }
    @PostMapping("/query")
    public Result queryUser(@RequestBody Userquery userquery){
        return userService.queryUser(userquery);
    }
    @PostMapping("/register")
    public Result registerUser(@RequestBody LoginFormatDto loginFormatDto){
        return userService.insertUser(loginFormatDto);
    }
    @PostMapping("/image")
    public Result uploadImage(@RequestBody MultipartFile multipartFile){
        return userService.setImage(multipartFile);
    }
}

